{% extends 'TopxiaWebBundle:CourseManage:layout.html.twig' %}

{% block title %}基本信息 - {{ parent() }}{% endblock %}

{% set side_nav = 'base' %}
{% set script_controller = 'course-manage/base' %}
{% 
	set script_arguments = {
	  categoryUrl: path('category_all'),
	  tagMatchUrl: path('tag_match'),
	  locationUrl: path('location_all')
	} 
%}
{% block main %}

<div class="panel panel-default panel-col">
	<div class="panel-heading">基本信息</div>
	<div class="panel-body">
		<form class="form-horizontal" id="course-form" method="post">

		  {{ web_macro.flash_messages() }}

			<div class="form-group">
				<label class="col-md-2 control-label">标题</label>
				<div class="col-md-8 controls">
					<input type="text" id="course_title" name="title" required="required" class="form-control" value="{{ course.title|default('') }}">
					<div class="help-block" style="display:none;"></div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-md-2 control-label">副标题</label>
				<div class="col-md-8 controls">
					<textarea id="course_subtitle" name="subtitle" required="required" class="form-control">{{ course.subtitle|default('') }}</textarea>
					<div class="help-block" style="display:none;"></div>
				</div>
			</div>

			<div class="form-group">
			  <label class="col-md-2 control-label">标签</label>
			  <div class="col-md-8 controls">
			  	<input type="text" id="course_tags" name="tags" required="required" class="width-full select2-offscreen" tabindex="-1" value="{{ tags|join(',') }}" data-explain="将会应用于按标签搜索课程、相关课程的提取等">
			  	<div class="help-block">将会应用于按标签搜索课程、相关课程的提取等</div>
			  </div>
			</div>

			{% if course.type == 'live' %}

			<div class="form-group">
			  <label class="col-md-2 control-label" for="maxStudentNum-field">直播最大学员数</label>
			 <div class="col-md-8 controls">
					<input type="text" id="maxStudentNum-field" name="maxStudentNum" class="form-control width-input width-input-large" value="{{ course.maxStudentNum|default(20) }}" data-live-capacity="{{ liveCapacity }}"> 人
					<div class="help-block" style="display:none;"></div>
				</div>
			</div>

			{% endif %}

			<div class="form-group">
			  <label class="col-md-2 control-label" for="course_expiryDay">学员有效期</label>
			  <div class="col-md-8 controls">
			    <input type="text" id="course_expiryDay" name="expiryDay" required="required" class="form-control width-input width-input-large" value="{{ course.expiryDay }}" data-widget-cid="widget-3" data-explain="设置该值后，学员只能在有效期内学习课程、发表话题、提问、笔记等，超过有效期后学员只能浏览课时目录及讨论区。该值为0，则不做此限制。"> 天
			    <div class="help-block">设置该值后，学员只能在有效期内学习课程、发表话题、提问、笔记等，超过有效期后学员只能浏览课时目录及讨论区。该值为0，则不做此限制。</div>
			  </div>
			</div>

			<div class="form-group">
			  <label class="col-md-2 control-label">到期提醒</label>
			  <div class="col-md-8 controls radios">
			  	{{ radios('deadlineNotify', {'active':'开启', 'none':'关闭'}, course.deadlineNotify|default('none') ) }}

			  	<div id="deadlineNotifyBlock" class="help-block" 
			  	{% if course.deadlineNotify == 'active' %}
			  	style="display:none"
			  	{% endif %}
			  	>系统会在该设置的到期天数前给学员发课程到期的通知。</div>
			  </div>
			</div>

			<div id="courseDaysOfNotifyBeforeDeadline" class="form-group"
				{% if course.deadlineNotify != 'active' %}
			  	style="display:none"
			  	{% endif %}
			>
			  <label class="col-md-2 control-label" >
			  </label>
			  <label for="course_daysOfNotifyBeforeDeadline" style="display:none">
			  	到期日期前的提醒天数
			  </label>
			  <div class="col-md-8 controls radios">
			  	到期日期前的 <input type="text" id="course_daysOfNotifyBeforeDeadline" name="daysOfNotifyBeforeDeadline" required="required" class="form-control width-input width-input-mini" 
			  	{% if course.daysOfNotifyBeforeDeadline|default(0)|number_format == 0 %}
			  	value="10"
			  	{% else %}
			  	value="{{ course.daysOfNotifyBeforeDeadline|default(10) }}"
			  	{% endif %}
			  	> 天系统自动提醒
			  </div>
			</div>

			{% if course.type == 'normal' %}
				<div class="form-group">
					<label class="col-md-2 control-label">连载状态</label>
					<div class="col-md-8 controls radios">
						{{ radios('serializeMode', {'none':'非连载课程', 'serialize':'更新中', 'finished':'已完结'}, course.serializeMode|default('none') ) }}
					</div>
				</div>
			{% endif %}

			<div class="form-group">
				<label class="col-md-2 control-label">显示学员人数</label>
				<div class="col-md-8 controls radios">
					{{ radios('showStudentNumType', {'opened':'开启', 'closed':'关闭'}, course.showStudentNumType ) }}
				</div>
			</div>

			<div class="form-group">
			  <label class="col-md-2 control-label">分类</label>
			  <div class="col-md-8 controls">
			    <select id="course_categoryId" name="categoryId" required="required" class="form-control width-input width-input-large">
			    	{{ select_options(category_choices('course'), course.categoryId, '分类') }}
			    </select>
			  	<div class="help-block" style="display:none;"></div>
			  </div>
			</div>
			{% if course.type == 'live'%}
			<div class="form-group">
			    <div class="col-md-offset-2 col-md-8 controls">
		    		<a href="http://www.edusoho.com/files/liveplugin/live_desktop_{{liveProvider}}.rar" target="_blank">直播“桌面分享”插件下载</a>
			    </div>
			</div>
			{% endif %}
		  <div class="form-group">
		    <div class="col-md-offset-2 col-md-8 controls">
		    	<button class="btn btn-fat btn-primary" id="course-create-btn" type="submit">保存</button>
		    </div>
		  </div>

		  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

		</form>
	</div>
</div>

{% endblock %}



